[Setup]
; 应用程序基本信息
AppName=LuHuoZai
AppVersion=1.0
AppPublisher=您的公司名称
AppPublisherURL=https://yourwebsite.com
AppSupportURL=https://yourwebsite.com/support
AppUpdatesURL=https://yourwebsite.com/updates
DefaultDirName={autopf}\LuHuoZai
DefaultGroupName=LuHuoZai
AllowNoIcons=yes
LicenseFile=
InfoBeforeFile=
InfoAfterFile=
OutputDir=installer
OutputBaseFilename=LuHuoZai_Setup
SetupIconFile=
Compression=lzma
SolidCompression=yes
WizardStyle=modern

; 系统要求
MinVersion=6.1
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64

; 卸载设置
UninstallDisplayIcon={app}\LuHuoZai.exe
UninstallDisplayName=LuHuoZai

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "chinesesimp"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 6.1

[Files]
; 主执行文件
Source: "build\LuHuoZai.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "build\UnityPlayer.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "build\UnityCrashHandler64.exe"; DestDir: "{app}"; Flags: ignoreversion

; 游戏数据文件夹
Source: "build\LuHuoZai_Data\*"; DestDir: "{app}\LuHuoZai_Data"; Flags: ignoreversion recursesubdirs createallsubdirs

; MonoBleedingEdge文件夹
Source: "build\MonoBleedingEdge\*"; DestDir: "{app}\MonoBleedingEdge"; Flags: ignoreversion recursesubdirs createallsubdirs

; 注意：排除调试信息文件夹（可选）
; Source: "build\LuHuoZai_BurstDebugInformation_DoNotShip\*"; DestDir: "{app}\LuHuoZai_BurstDebugInformation_DoNotShip"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\LuHuoZai"; Filename: "{app}\LuHuoZai.exe"
Name: "{group}\{cm:UninstallProgram,LuHuoZai}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\LuHuoZai"; Filename: "{app}\LuHuoZai.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\LuHuoZai"; Filename: "{app}\LuHuoZai.exe"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\LuHuoZai.exe"; Description: "{cm:LaunchProgram,LuHuoZai}"; Flags: nowait postinstall skipifsilent

[Registry]
; 添加到Windows程序列表
Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\LuHuoZai"; ValueType: string; ValueName: "DisplayName"; ValueData: "LuHuoZai"
Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\LuHuoZai"; ValueType: string; ValueName: "DisplayVersion"; ValueData: "1.0"
Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\LuHuoZai"; ValueType: string; ValueName: "Publisher"; ValueData: "您的公司名称"
Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\LuHuoZai"; ValueType: string; ValueName: "UninstallString"; ValueData: "{uninstallexe}"

[Code]
// 检查是否已安装Visual C++ Redistributable
function VCRedistNeedsInstall: Boolean;
var
  Version: String;
begin
  Result := not RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', Version);
end;

// 自定义安装前检查
function InitializeSetup(): Boolean;
begin
  Result := True;
  
  // 检查系统要求
  if not IsWin64 then
  begin
    MsgBox('此游戏需要64位Windows系统。', mbError, MB_OK);
    Result := False;
  end;
  
  // 可以添加其他检查，如DirectX、.NET Framework等
end; 